import request from '@/config/axios'

// 服务采购详情 VO
export interface PurchaseServiceDetailVO {
  id: number // 采购详情ID
  planId: number // 采购计划ID
  purchasePlanNo: string // 采购计划编号
  purchaseType: string // 采购类型SERVICE/EQUIPMENT/NGINEERING/MATERIAL/DIRECT/MINOR
  purchaseContent: string // 采购内容(详细)
  servicePeriod: string // 服务期限
  serviceLocation: string // 服务地点
  supplierQualification: string // 供应商资质要求
  technicalReview: string // 技术评审单
  currentInventory: string // 现有库存数量
  unit: string // 单位
  estimatedQuantity: number // 预估采购数量
  estimatedUnitPrice: number // 预估单价(元/含税)
  totalAmount: number // 合计
  remark: string // 备注
}

// 服务采购详情 API
export const PurchaseServiceDetailApi = {
  // 查询服务采购详情分页
  getPurchaseServiceDetailPage: async (params: any) => {
    return await request.get({ url: `/erp/purchase-service-detail/page`, params })
  },

  // 查询服务采购详情详情
  getPurchaseServiceDetail: async (id: number) => {
    return await request.get({ url: `/erp/purchase-service-detail/get?id=` + id })
  },

  // 新增服务采购详情
  createPurchaseServiceDetail: async (data: PurchaseServiceDetailVO) => {
    return await request.post({ url: `/erp/purchase-service-detail/create`, data })
  },

  // 修改服务采购详情
  updatePurchaseServiceDetail: async (data: PurchaseServiceDetailVO) => {
    return await request.put({ url: `/erp/purchase-service-detail/update`, data })
  },

  // 删除服务采购详情
  deletePurchaseServiceDetail: async (id: number) => {
    return await request.delete({ url: `/erp/purchase-service-detail/delete?id=` + id })
  },

  // 导出服务采购详情 Excel
  exportPurchaseServiceDetail: async (params) => {
    return await request.download({ url: `/erp/purchase-service-detail/export-excel`, params })
  },
}